Repository navigation
Conversation
DeleteMCPService, GetMCPServiceTools and GetMCPServiceResources returned an
untyped error for a missing registration, so their handlers answered 500
Internal server error while GET /mcp-services/{id} already answered 404.
Return the existing types.ErrMCPServiceNotFound sentinel from those three
service methods and map it to 404 in the handlers; any other error stays a
500 and no longer echoes internals into the response.
Yuaneen
force-pushed
the
fix/mcp-service-not-found-404
branch
from
November 30, 2026 06:40
0ee54d6 to
011829e
Compare
Yuaneen
marked this pull request as ready for review
November 30, 2026 07:04
7 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
DELETE /mcp-services/{id},GET /mcp-services/{id}/toolsandGET /mcp-services/{id}/resourcesreturned500 Internal server errorwhen the registration did not exist, whileGET /mcp-services/{id}already returned404for the same missing resource.The three service methods returned
fmt.Errorf("MCP service not found")instead of the existingtypes.ErrMCPServiceNotFoundsentinel (already returned byGetMCPServiceByIDsince #5921), so the handlers could not classify the miss and wrapped every error as an internal error. That also echoed the wrapped error text into the response body.Return the sentinel from
DeleteMCPService,GetMCPServiceToolsandGetMCPServiceResources, and map it to404in the handlers. Any other error (for example a storage failure) stays a500and no longer appends internals to the message.Type of Change
Related Issue
Fixes #6207
Testing
TestMCPServiceMissingRegistrationReturnsNotFound: all three endpoints return 404 and the body does not containInternal server error.TestMCPServiceLookupFailureStaysInternalError: after closing the DB, all three still return 500 and the body does not containdatabase is closed.expected: 404, actual: 500, and the second failed because the storage error was echoed; both pass after the fix.go test ./internal/handler -run 'TestMCPService' -count=1-> okgo test ./internal/handler -run 'MCP' -count=1-> okgo build ./internal/handler ./internal/application/service-> okgofmt -lon the changed files -> no outputgit diff --check origin/main...HEAD-> passesThe full root-module
go test ./...was not run locally because the environment cannot link the prebuilt DuckDB archives; CI covers it.golangci-lintis not installed in this environment.Codex assisted with the implementation and test preparation; I reviewed the diff and ran the focused checks above.
Checklist
git diff --check origin/main...HEADpassesgolangci-lint(passes in CI in 1m22s)go test ./...(covered by the CI "Format, vet, test, and build" job, 22m22s, pass)